package Cantella::DJabberd::Web::UI::Widget::Layout;

use Reaction::UI::WidgetClass;

class Layout, which {

  before fragment viewport {
    arg title => $_{viewport}->title;
  };

  implements fragment stylesheets {
    render stylesheet => over $_{viewport}->stylesheets;
  };

  implements fragment menu {
    arg '_' => $_{viewport}->menu;
    render 'viewport';
  };

  implements fragment submenu {
    arg '_' => $_{viewport}->submenu;
    render 'viewport';
  };

  implements fragment auth {
    arg '_' => $_{viewport}->auth_vp;
    render 'viewport';
  };

  implements fragment sidebar {
    arg '_' => $_{viewport}->sidebar;
    render 'viewport';
  };

  implements fragment stylesheet {
    arg uri => $_;
  };

  implements fragment javascripts {
    render javascript => over $_{viewport}->javascripts;
  };

  implements fragment javascript {
    arg uri => $_
  };

  implements fragment main_content {
    if ( my $inner = $_{viewport}->inner ) {
      arg '_' => $inner;
      render 'viewport';
    } else {
      $_{viewport}->ctx->log->debug("no inner");
    }
  };

};

1;

__END__;
